# Maintainer: Jelle van der Waa <jelle@vdwaa.nl>

_gemname=mustermann
pkgname=ruby-${_gemname}
pkgver=3.0.0
pkgrel=1
pkgdesc="Your personal string matching expert"
arch=(any)
url="https://github.com/sinatra/mustermann"
license=('MIT')
depends=('ruby' 'ruby-ruby2_keywords')
options=('!emptydirs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/sinatra/mustermann/archive/v${pkgver}.tar.gz)
md5sums=('6c219b73546b2c74b2bd0f2249d760f5')

prepare() {
  cd ${_gemname}-${pkgver}/${_gemname}
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec
  sed 's|git ls-files|find|' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}/${_gemname}
  gem build ${_gemname}.gemspec
}

package() {
  cd ${_gemname}-${pkgver}/${_gemname}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"

  install -Dm 644 ../LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}
